#此扩展用于的模块扩展处理,用于支撑模块的
#   EWX_HAS_CONAN_ENV:
#       此变量是公共cmake模块查找conan环境决定的变量类型
#       目的是为了支撑conan方式和非conan方式的同时处理
#   此模块主要决定以下几个环境支撑
#   [1]查找模块
#   [2]编绎目标
#   [3]调试环境变量:
#       生成VS调试环境的变量处理
#   安装:
#       自动安装库文件到安装目录
include(support_3rd_utils)
SET(SUPPORT_3RD_PKG_NAME gtest)

IF(EWX_HAS_CONAN_ENV)
    message(NOTICE "${SUPPORT_3RD_PKG_NAME} Use Conan Env Mode....")
    find_package(${SUPPORT_3RD_PKG_NAME} REQUIRED)
    if(gtest_INCLUDE_DIR)
        SET(GTEST_INCLUDE_DIR ${gtest_INCLUDE_DIR})
    endif()
ELSE()
    message(NOTICE "${SUPPORT_3RD_PKG_NAME} Use Normal Package Mode....")
    IF(NOT ${SUPPORT_3RD_PKG_NAME}_ROOT_DIR OR NOT EXISTS ${${SUPPORT_3RD_PKG_NAME}_ROOT_DIR})
        IF(WIN32)
            SEARCH_3RD_MAYBE_PATH(${SUPPORT_3RD_PKG_NAME}_ROOT_DIR 
                ${PROJECT_3RDPARTY_DIR}/gtest-1.8.1-x64-vs2017
            )
        ELSE()
            GET_THIRD_PARTY_PACKAGE_DIR_NAME("gtest-1.8.0" full_package_name0)
            GET_THIRD_PARTY_PACKAGE_DIR_NAME("gtest-1.8.1" full_package_name1)
            SEARCH_3RD_MAYBE_PATH(${SUPPORT_3RD_PKG_NAME}_ROOT_DIR 
                ${PROJECT_3RDPARTY_DIR}/${full_package_name0}
                ${PROJECT_3RDPARTY_DIR}/${full_package_name1}
            )
        ENDIF()
    ENDIF()

    find_package(${SUPPORT_3RD_PKG_NAME} REQUIRED)
    if(gtest_INCLUDE_DIR)
        SET(GTEST_INCLUDE_DIR ${gtest_INCLUDE_DIR})
    endif()
ENDIF()